package com.ruoyi.by.health.service.impl;

import com.ruoyi.by.health.domain.entity.ByhealthLotteryOutcome;
import com.ruoyi.by.health.mapper.ByhealthLotteryOutcomeMapper;
import com.ruoyi.by.health.service.IByhealthLotteryOutcomeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @ClassName ByhealthLotteryOutcomeService
 * @Author 张敬琦
 * @Description 添加描述
 * @Date 2024/1/19 11:16
 **/
@Service
public class ByhealthLotteryOutcomeService implements IByhealthLotteryOutcomeService {
    @Autowired
    ByhealthLotteryOutcomeMapper lotteryOutcomeMapper;

    @Async
    @Override
    public void batchInsertLotteryOutcome(List<ByhealthLotteryOutcome> lotteryOutcomes) {
        for (ByhealthLotteryOutcome lotteryOutcome : lotteryOutcomes) {
            lotteryOutcome.setCreateTime(new Date());
            lotteryOutcomeMapper.insert(lotteryOutcome);
        }
    }
    @Async
    @Override
    public void batchInsertBigLotteryOutcome(List<ByhealthLotteryOutcome> lotteryOutcomes) throws InterruptedException {
        for (ByhealthLotteryOutcome lotteryOutcome : lotteryOutcomes) {
            Thread.sleep(1000);
            lotteryOutcome.setCreateTime(new Date());
            lotteryOutcomeMapper.insert(lotteryOutcome);
            Thread.sleep(2000);
        }
    }

    @Override
    public List<ByhealthLotteryOutcome> getLotteryOutcomeByEmpId(Long empId) {
        return lotteryOutcomeMapper.getLotteryOutcomeByEmpId(empId);
    }

    @Override
    public List<ByhealthLotteryOutcome> getLotteryOutcomeByRulesId(Long rulesId) {
        return lotteryOutcomeMapper.getLotteryOutcomeByRulesId(rulesId);
    }

    @Override
    public List<ByhealthLotteryOutcome> selectLotteryOutcomeList(ByhealthLotteryOutcome lotteryOutcomes) {
        return lotteryOutcomeMapper.selectLotteryOutcomeList(lotteryOutcomes);
    }
}
